package com.umeox.moto.watch.themes.skin.entity;

import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.TextView;

import com.umeox.moto.watch.themes.skin.loader.ResourceManager;


public class CompoundAttr extends SkinAttr {

    @Override
    public void apply(View view) {
        TextView textView = (TextView) view;
        if (RES_TYPE_NAME_DRAWABLE.equals(attrValueTypeName)) {
            Drawable[] drawables = new Drawable[4];
            final int i = AttrFactory.compoundList.indexOf(attrName);
            Drawable drawable = ResourceManager.getInstance().getDrawable(attrValueRefId);
            switch (i) {
                case 0:
                case 1:
                    drawables[0] = drawable;
                    break;
                case 2:
                    drawables[1] = drawable;
                    break;
                case 3:
                case 4:
                    drawables[2] = drawable;
                    break;
                case 5:
                    drawables[3] = drawable;
                    break;
            }
            textView.setCompoundDrawablesRelativeWithIntrinsicBounds(drawables[0], drawables[1], drawables[2], drawables[3]);
        }

    }
}
